<template>
	<view class="scroll">
		<view class="scroll_fixed">
			<scroll-view scroll-y class="list-scroll" @scrolltolower="loadMore">
				<!-- 因为滚动之后会出现最后一个无法完全显示的bug，添加padding-bottom style="padding-bottom: 20vh;"-->
				<view>
					<slot></slot>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// statusBarHeight: 20,
				// navBarHeight: 45
			};
		},
		// created() {
		// 	const { statusBarHeight, windowWidth }  = uni.getSystemInfoSync()
		// 	this.statusBarHeight = statusBarHeight
		// 	this.windowWidth = windowWidth
		// }
		methods: {
			loadMore() {
				this.$emit('loadMore')
			}
		}
	}
</script>

<style lang='scss'>
	.scroll {
		flex: 1;
		/* 解决高度100%无法滚动 */
		/* 假设外层是未知高度 先定义一个盒子 设为固定定位 宽高设置为100% */
		box-sizing: border-box;
		overflow: hidden;
		.scroll_fixed {
			position: fixed;
			height: 100%;
			width: 100%;
			.list-scroll {
				height: 100%;
				display: flex;
				flex-direction: column;
			}
		}
	}
</style>
